chrome.extension.onRequest.addListener(
  function(request, sender, sendResponse) {
    if (request.command == "getSelection")
      sendResponse({selection: window.getSelection().toString()});
    else
      sendResponse({}); // snub them.
  });